﻿@{
    ViewBag.Title = "fileupdate";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>显示上传的页面</h2>
<script>
    $(document).ready(function () {
        show(1);
    });
    function show(i)
    {
        $("#page tr td").empty();
        $("#file tbody").empty();
        $.ajax({
            type: "get",
            url: "/Home/showfile",
            data: {
                "index": i,
                "size":10
            },
            success: function (data) {
                $(data.dblist).each(function (i, obj) {
                    var tr = "<tr><td>" + obj.fid + "</td><td>" + obj.filename + "</td><td>" + obj.FileTyep + "</td><td>" + obj.ProjectName + "</td><td>" + obj.Name + "</td><td>" + obj.fileDate + "</td><td>"+obj.fileState+"</td><td><a href='/Home/downfile?filepath="+obj.filename+"'>下载</a></td></tr>"
                    $("#file tbody").append(tr);
                })
                var a="<a onclick='show(1)'>首页</a>"
                if (data.pageindex-1 > 0)
                {
                    var a1 = "<a onclick='show(" + (data.pageindex - 1) + ")'>上一页</a>"
                }
                if (data.pageindex < data.dbcount)
                {
                    var a2 = "<a onclick='show(" + (data.pageindex +1) + ")'>下一页</a>"
                }
                a3 = "<a onclick='show(" + data.dbcount + ")'>尾页</a>"
                $("#page tr td").append(a);
                $("#page tr td").append(a1);
                $("#page tr td").append(a2);
                $("#page tr td").append(a3);
            }
        })
    }
</script>
<div>
    <table id="file" class="table table-condensed">
        <thead>
            <tr>
                <th>文件编号</th>
                <th>文件名称</th>
                <th>文件类型</th>
                <th>项目名称</th>
                <th>上传者</th>
                <th>上传时间</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody></tbody>
    </table>
    <table id="page" class="table table-condensed">
        <tr align="center">
            <td></td>
        </tr>
    </table>
    
</div>
